package main

import "fmt"

func main() {

	/*
		一维数组
	*/

	//初始化默认为0
	var arr1 [5]int
	fmt.Println(arr1)

	var arr2 = [4]int{1, 2, 3, 4}
	fmt.Println(arr2)

	arr3 := [5]int{1, 2, 3, 4, 5}
	fmt.Println(arr3)

	arr4 := [...]int{1, 2, 3, 4, 5, 6}
	fmt.Println(arr4)

	//前一位为索引，后一位为值
	arr5 := [...]int{0: 3, 1: 5, 4: 6, 2: 10}
	fmt.Println(arr5)

	/*
		二维数组
	*/
	var arr6 = [3][2]int{{1, 2}, {3, 4}, {5, 6}}
	fmt.Println(arr6)

	arr7 := [3][2]int{{1, 2}, {3, 4}, {5, 6}}
	fmt.Println(arr7)

	arr8 := [...][2]int{{1, 2}, {3, 4}, {5, 6}, {7, 8}}
	fmt.Println(arr8)

	arr9 := [...][5]int{{0: 4, 4: 2}, {3, 4}, {5, 6}, {7, 8}}
	fmt.Println(arr9)

}
